package Day08.Demo03;

/**
 * @author HYHwtx
 * @version 1.0
 * @date 2022/2/21 13:20
 */
public class Student {
    private  int id;//学号
    private String name;
    private  int age;
    static  String room;
    private static int idCoder = 0;//学号计数器,每当new一个新对象的时候，计数器++



    public  Student(){
        idCoder++;

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        this.id=++idCoder;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
